﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Reference.Apps"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
    x:Class="Reference.Apps.SearchView"
    mc:Ignorable="d"
    >
	<Page.Resources>
	</Page.Resources>
	<Page.Background>
		<StaticResource ResourceKey="ApplicationPageBackgroundBrush"/>
	</Page.Background>
	<Page.DataContext>
		<Binding Mode="OneWay" Path="Main" Source="{StaticResource VMLocator}"/>
	</Page.DataContext>
	<Page.BottomAppBar>
		<CommandBar>
			<AppBarButton Icon="Accept" Label="appbarbutton" Command="{Binding SearchCommand, Mode=OneWay}"/>
		</CommandBar>
	</Page.BottomAppBar>

	<Grid x:Name="LayoutRoot">

		<Grid.ChildrenTransitions>
			<TransitionCollection>
				<EntranceThemeTransition/>
			</TransitionCollection>
		</Grid.ChildrenTransitions>

		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<!-- Title Panel -->
		<StackPanel Grid.Row="0" Margin="19,0,19,0">
			<TextBlock x:Uid="WP8AppNameTextBlock" Text="MY APPLICATION" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0" Foreground="{StaticResource ApplicationContrastBackgroundBrush}"/>
            <TextBox x:Name="SearchTextBox" Foreground="#39393B" Background="White" Text="{Binding SearchTerm, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" InputScope="Search"></TextBox>
		</StackPanel>

        <!--TODO: Content should be placed within the following grid-->
		<Grid Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
			
			<ProgressBar HorizontalAlignment="Left" Height="10" VerticalAlignment="Top" Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibilityConverter}}" Width="{Binding ActualWidth, ElementName=listView}" IsIndeterminate="True" />

            <ListView x:Name="listView" IsItemClickEnabled="True" ItemClick="SnippetsListItem_Click" ItemTemplate="{StaticResource WPCodeSnippetTemplate}" ItemsSource="{Binding SearchResults}" Margin="0,12,0,0"/>
			

		</Grid>
	</Grid>
</Page>
